package com.moro.lisp.typedefine;

import java.util.ArrayList;
import java.util.List;

import com.moro.lisp.JLispData;
import com.moro.lisp.JLispType;

public class Char {
	private static List<Char> charList;
	public char ch;
	private Char(char ch) {
		this.ch = ch;
	}
	public static Char getChar(char ch) {
		if(null == Char.charList) {
			charList = new ArrayList<Char>();
		}
		for(int i = 0;i < Char.charList.size();i++) {
			if(ch == Char.charList.get(i).ch) {
				return Char.charList.get(i);
			}
		}
		Char c = new Char(ch);
		Char.charList.add(c);
		return c;
	}
	public JLispData eval() {//对字符求值一样不需要符号池
		return new JLispData(this, JLispType.CHAR);
	}
}
